package suzf.top.usercenter.presenter

import android.util.Log
import suzf.top.base.ext.execute
import suzf.top.base.presenter.BasePresenter
import suzf.top.base.rx.BaseSubscriber
import suzf.top.base.utils.NetWorkUtils
import suzf.top.usercenter.presenter.view.ForgetPwdView
import suzf.top.usercenter.presenter.view.RegisterView
import suzf.top.usercenter.presenter.view.ResetPwdView
import suzf.top.usercenter.service.UserService
import javax.inject.Inject

/**
 *
 *========================
 * Created with AndroidStudio
 * Author:Mr.Su
 * Date:2019-09-07
 * Time:20:56
 * ========================
 */
class ResetPwdPresenter @Inject constructor() : BasePresenter<ResetPwdView>() {

    @Inject
    lateinit var userService: UserService

    fun resetPwd(mobile: String, pwd: String) {
        /**
        业务逻辑处理
         */
        if (!checkNetWork()) {
            return
        }
        mView.showLoading()
        userService.resetPwd(mobile, pwd)
                .execute(object : BaseSubscriber<Boolean>(mView) {
                    override fun onNext(t: Boolean) {
                        if (t) mView.onResetPwdResult("找回密码")
                    }
                }, lifecycleProvider)

    }

}